package com.itheima.blog.admin.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.blog.admin.dao.TLogMapper;
import com.itheima.blog.admin.entity.TLog;
import com.itheima.blog.admin.service.ITLogService;
import com.itheima.common.domain.PageReqDto;
import com.itheima.common.domain.PageResDto;
import com.itheima.common.query.PageQuery;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author JXP
 * @since 2023-07-12
 */
@Service
public class TLogServiceImpl extends ServiceImpl<TLogMapper, TLog> implements ITLogService {

    @Override
    public PageResDto<TLog> getPageList(PageQuery page) {
        PageReqDto pageReqDto = new PageReqDto();
        pageReqDto.setPage(page.getPageNo());
        pageReqDto.setSize(page.getPageSize());

        Page<TLog> tLogPage = lambdaQuery().page(page.toMpPage());

        return new PageResDto<>(pageReqDto, tLogPage.getTotal(), tLogPage.getRecords());
    }
}